<template>
  <div class="gap">
    <h2>保险种类修改</h2>
    <el-form :model="update" status-icon ref="update" label-width="70px" class="demo-update">
      <el-form-item label="名字">
        <el-input type="text" v-model="update.categoryName" max="250px"></el-input>
      </el-form-item>

      <!-- <el-form-item label="类别">
        <el-form-item label="种类">
          <el-select v-model="value" placeholder="请选择保险种类">
            <el-option
              v-for="item in pageData.data"
              :key="item._id"
              :label="item.categoryName"
              :value="item._id"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-form-item> -->
    
      <!-- <el-button @click="show">1234</el-button> -->
      <el-form-item>
        <el-button type="primary" @click="updatecategory1(update)">修改保险分类</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import axios from "axios";
import Category from "./Cascader.vue";
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions } = createNamespacedHelpers("productcategory");

export default {
  components: {
    Category,
  },
  data() {
    return {
      value:""
    }
  },
  computed: {
    ...mapState(["update", "pageData"]),
  },
  created() {
    this.showCategorys();
  },
  methods: {
    ...mapActions(["updatecategory", "showCategorys"]),
    async updatecategory1(update) {
      const data = await this.updatecategory(update);
      console.log(data);
      if (data.status) {
        this.$router.push("/system/categorylist");
      }
    },
    show(){
      console.log(this.pageData.data);
    }
  },
};
</script>